//
//  KCCircleView.swift
//  MyKC
//
//  Created by yy on 2017/3/17.
//  Copyright © 2017年 com.yasuo. All rights reserved.
//

import UIKit

class KCCircleView: UIView {
    var percent: CGFloat? {
        //外界已经完成了的赋值
        didSet {
            setNeedsDisplay()
        }
    }
//    var percent: CGFloat = 0
    override func draw(_ rect: CGRect) {
        let path = UIBezierPath(arcCenter: CGPoint(x: ScreenWidth / 6.0, y: 91.5), radius: (ScreenWidth / 6.0) - 20.0, startAngle: 0, endAngle: CGFloat(M_PI * 2), clockwise: true)
        UIColor.orange.setStroke()
        path.lineWidth = 15
        path.stroke()
        
        let pathMax = UIBezierPath(arcCenter: CGPoint(x: ScreenWidth / 6.0, y: 91.5), radius: (ScreenWidth / 6.0) - 17.5, startAngle: 0, endAngle: CGFloat(M_PI * 2) * (percent ?? 0), clockwise: false)
        UIColor.yellow.setStroke()
        pathMax.lineWidth = 20
        pathMax.stroke()
    }
}
